﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using flowers;
using _3;
namespace txi5
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        factory aa = new factory();
        List<flowers.flowerses.flowers> buketA = new List<flowers.flowerses.flowers>();
        public MainWindow()
        {

            InitializeComponent();

            comboBox2.Items.Add("римская");
            comboBox2.Items.Add("персидская");
            comboBox2.Items.Add("немецкая");

            comboBox3.Items.Add("рускус");
            comboBox3.Items.Add("папоротник");
            comboBox3.Items.Add("гиперикум");
            comboBox3.Items.Add("солидаго");


            comboBox1.Items.Add("красная");
            comboBox1.Items.Add("синяя");
            comboBox1.Items.Add("желтая");
            comboBox1.Items.Add("белая");
            textBox2.Text = "0";
            textBox3.Text = "0";
            textBox1.Text = "0";
            //comboBox1.Items.Add("4");
            //factory aa = new factory();
            //List<flowers.flowerses.flowers> buketA = new List<flowers.flowerses.flowers>();
            //int textBox3;
            //textBox3.I
        }

        private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)//тип роза
        {
           
            
        }

        private void listBox3_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("досвидания!");
            Environment.Exit(0);
            
        }

        private void textBox3_TextChanged(object sender, TextChangedEventArgs e)
        {
            string svetRoza="";
            int stoimostRoza = 300;
            int kolRoza = Convert.ToInt32(textBox3.Text);
            //buketA.Clear();
            if (comboBox1.SelectedIndex == 0) 
                svetRoza = "красная";
            if (comboBox1.SelectedIndex == 1) 
                svetRoza = "синяя";
            if (comboBox1.SelectedIndex == 2) 
                svetRoza = "желтая";
            if (comboBox1.SelectedIndex == 3) 
                svetRoza = "белая";

            if (kolRoza > 0)
                for (int i = 0; i < kolRoza; i++)                
                    buketA.Add(aa.newRoza(svetRoza, stoimostRoza));

        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            //
            flowers.flowerses.buket buket = aa.newBuket(buketA);
            MessageBox.Show("стоимость букета: " + buket.stoimosts);
            buketA.Clear();
            textBox2.Text = "0";
            textBox3.Text = "0";
            textBox1.Text = "0";

            //{
            //    string a = Convert.ToString(Convert.ToInt32(textBox3.Text) + 1);
            //    //string aa = Convert.ToString(a);
            //    MessageBox.Show (a);
            //}

        }

        private void textBox2_TextChanged(object sender, TextChangedEventArgs e)
        {
            int stoimostRoma = 100;
            int kolRoma = Convert.ToInt32(textBox2.Text);
            string tipRoma="";
            //buketA.Clear();
            if (comboBox1.SelectedIndex == 0)
                tipRoma = "римская";
            if (comboBox1.SelectedIndex == 1)
                tipRoma = "персидская";
            if (comboBox1.SelectedIndex == 2)
                tipRoma = "немецкая";

            if (kolRoma > 0)
                for (int i = 0; i < kolRoma; i++)
                    buketA.Add(aa.newRoza(tipRoma,stoimostRoma));



        }

        private void textBox1_TextChanged(object sender, TextChangedEventArgs e)
        {
            int stoimostTrava = 50;
            int kolTrava= Convert.ToInt32(textBox1.Text);
            string nazvanieTrava="";

            if (comboBox3.SelectedIndex == 0)
                nazvanieTrava = "рускус";
            if (comboBox3.SelectedIndex == 1)
                nazvanieTrava = "папоротник";
            if (comboBox3.SelectedIndex == 2)
                nazvanieTrava = "гиперикум";
            if (comboBox3.SelectedIndex == 3)
                nazvanieTrava = "солидаго";
            if (kolTrava > 0)
                for (int i = 0; i < kolTrava; i++)
                    buketA.Add(aa.newTrava(stoimostTrava, nazvanieTrava));

        }

        private void comboBox2_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

        }
    }
}
